package ae.pcfc.etks.online.common.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * Client entity. @author Mohtisham.Salahria
 */
@Entity
@Table(name = "T_ETKS_CLIENT", schema = "ETKS_ONLINE_DBA", uniqueConstraints = @UniqueConstraint(columnNames = {"C_TRAKHEES_ID"}))
@SequenceGenerator(name = "SQ_ETKS_CLIENT", sequenceName = "SQ_ETKS_CLIENT", initialValue = 1, allocationSize = 1)
public class Client implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7543349500926047487L;
	// Fields

	private Long CId;
	private String CTrakheesId;	
	private String CType;
	private String CStatus;
	private Date CCreateDate;
	private Set<ClientServiceRole> ClientServiceRoles = new HashSet<ClientServiceRole>(
			0);
	private Set<User> Users = new HashSet<User>(0);

	// Constructors

	/** default constructor */
	public Client() {
	}

	/** minimal constructor */
	public Client(String CTrakheesId, String CType,
			String CStatus, Date CCreateDate) {
		this.CTrakheesId = CTrakheesId;		
		this.CType = CType;
		this.CStatus = CStatus;
		this.CCreateDate = CCreateDate;
	}

	/** full constructor */
	public Client(String CTrakheesId, String CType,
			String CStatus, Date CCreateDate,
			Set<ClientServiceRole> ClientServiceRoles,
			Set<User> Users) {
		this.CTrakheesId = CTrakheesId;		
		this.CType = CType;
		this.CStatus = CStatus;
		this.CCreateDate = CCreateDate;
		this.ClientServiceRoles = ClientServiceRoles;
		this.Users = Users;
	}

	// Property accessors
	@Id
	@GeneratedValue( strategy = GenerationType.SEQUENCE, generator="SQ_ETKS_CLIENT")
	@Column(name = "C_CLIENT_ID", nullable = false, precision = 11, scale = 0)
	public Long getCId() {
		return this.CId;
	}

	public void setCId(Long CId) {
		this.CId = CId;
	}

	@Column(name = "C_TRAKHEES_ID", nullable = false, length = 50)
	public String getCTrakheesId() {
		return this.CTrakheesId;
	}

	public void setCTrakheesId(String CTrakheesId) {
		this.CTrakheesId = CTrakheesId;
	}
	
	@Column(name = "C_TYPE", nullable = false, length = 1)
	public String getCType() {
		return this.CType;
	}

	public void setCType(String CType) {
		this.CType = CType;
	}

	@Column(name = "C_STATUS", nullable = false, length = 1)
	public String getCStatus() {
		return this.CStatus;
	}

	public void setCStatus(String CStatus) {
		this.CStatus = CStatus;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "C_CREATE_DATE", nullable = false, length = 7)
	public Date getCCreateDate() {
		return this.CCreateDate;
	}

	public void setCCreateDate(Date CCreateDate) {
		this.CCreateDate = CCreateDate;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "client")
	public Set<ClientServiceRole> getClientServiceRoles() {
		return this.ClientServiceRoles;
	}

	public void setClientServiceRoles(
			Set<ClientServiceRole> ClientServiceRoles) {
		this.ClientServiceRoles = ClientServiceRoles;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "client")
	public Set<User> getUsers() {
		return this.Users;
	}

	public void setUsers(Set<User> Users) {
		this.Users = Users;
	}

}